package com.aba.im.ui;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class ChatRoomUI extends JFrame {

    private JComboBox<String> roomComboBox;
    private JButton privateChatButton;

    public ChatRoomUI() {
        setTitle("聊天房间界面");
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(400, 300);
        setLayout(new FlowLayout());

        // 初始化房间选择下拉框
        String[] rooms = {"房间1", "房间2", "房间3"};
        roomComboBox = new JComboBox<>(rooms);
        add(roomComboBox);

        // 初始化私聊按钮
        privateChatButton = new JButton("私聊");
        privateChatButton.addActionListener(new PrivateChatListener());
        add(privateChatButton);

        setVisible(true);
    }

    // 私聊按钮点击事件监听器
    class PrivateChatListener implements ActionListener {
        @Override
        public void actionPerformed(ActionEvent e) {
            JOptionPane.showMessageDialog(ChatRoomUI.this, "私聊功能暂未实现，敬请期待！");
        }
    }

    public static void main(String[] args) {
        new ChatRoomUI();
    }
}

